<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>对象</title>
</head>
<body>
    <script>
        //键值对 key:value
        const stu = {name:'jack',age:19};
        const stu2 = {name:'tom',age:22};
        // console.log(stu.name,stu.age)
        // console.log(stu2.name,stu2.age)

        const stus = [
            {name:'jack',age:19},
            {name:'mike',age:28},
            {name:'peter',age:11},
            {name:'rose',age:16},
            {name:'tom',age:22}];

        for (let i = 0; i < stus.length; i++) {
            console.log(stus[i].name,stus[i].age)
            if(stus[i].age<18){
                stus[i].age=18
            }
        }

        for (let i = 0; i < stus.length; i++) {
            console.log(stus[i].name,stus[i].age)
        }
    </script>
</body>
</html>